<link href="<?= APP_STATIC_PATH ?>/admin/css/wechat.css" rel="stylesheet">
<script type="text/javascript" src="<?= APP_STATIC_PATH ?>/admin/js/bootstrap.modal.ext.js"></script>
<script type="text/javascript" src="<?= APP_STATIC_PATH ?>/admin/js/wechat.jquery.notice.js"></script>
<script type="text/javascript">

  'use strict';

  (function ($) {
    $.fn.extend({
      //左侧菜单高亮
      heightLight: function () {
        var path = window.location.pathname.substr(1);
        var $buttons = $('#side-menu').find('a');
        path && $buttons.length && $.each($buttons, function (i, btn) {
          var href = $(btn).prop('href');
          if (href && href.indexOf(path) > -1) {
            return $(btn).parent('li').addClass('active');
          }
        });
      },

      //鼠标移入面板效果
      hoverPanel: function () {
        this.on('mouseleave', function () {
          $(this).addClass('panel-default').removeClass('panel-primary')
              .find('table tbody th').removeClass('active');
          $(this).find('table thead th').removeClass('info');
        }).on('mouseenter', function () {
          $(this).addClass('panel-primary').removeClass('panel-default')
              .find('table tbody th').addClass('active');
          $(this).find('table thead th').addClass('info');
        });
      },
      tableColHover: (function ($) {
        var _$tables = [],
            _default = {
              style: 'active'
            };
        return function (configuration) {
          _$tables = this;
          switch ($.type(configuration)) {
            case 'object':
              configuration = $.extend({}._default, configuration);
              break;
            case 'string':
              _default.style = configuration;
              configuration = _default;
              break;
            default:
              configuration = _default;
          }
          _$tables.each(function () {
            var $table = $(this);
            $table.find('th,td').hover(
                function (event) {
                  var $row = $(this).parent();
                  var this_i = $row.find('th,td').index(this);
                  $table.find('tr').each(function (i, row) {
                    $(row).find('th,td').each(function (ii, cell) {
                      if (ii == this_i) {
                        $(cell).addClass(configuration.style);
                      } else {
                        $(cell).removeClass(configuration.style);
                      }
                    });
                  })
                },
                function (event) {
                }
            );
          });
        };
      }(jQuery))
    });

  }(jQuery));

  $(function () {

    $('body').heightLight();//右侧菜单高亮
    $('.panel-hover').hoverPanel(); //面板高亮

    //调整wrapper高度:别没事弄个min-height把页面撑那么长,一点美感都有没有!
    (function ($) {
      var $wrapper = $('#page-wrapper');
      var wrapper_height = $wrapper.outerHeight();
      var window_height = $(window).height() - $('nav[role="navigation"]').outerHeight();

      console.log(window_height, wrapper_height);

      if (window_height > wrapper_height) {
        $wrapper.css({height: window_height});
      }
    }(jQuery));

  });

</script>